<?php
namespace app\course\validate\live\admin;

use think\Validate;

/**
 * 用户验证
 */
class LiveSmall extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'mhm_id'          => 'require',
        'title'           => 'require',
        'cover'           => 'require',
        'scribing_price'  => 'require',
        'price'           => 'require',
        'teacher_id'      => 'require',
        'status'          => 'require',
        'limit_buy_count' => 'require|integer|between:1,16',

    ];

    protected $field = [
        'title'           => '课程名称',
        'cover'           => '封面',
        'price'           => '销售价',
        'scribing_price'  => '原价',
        'mhm_id'          => '机构',
        'teacher_id'      => '讲师',
        'status'          => '状态',
        'limit_buy_count' => '购买人数',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'title.require'          => '请输入课程名称',
        'cover.mobile'           => '请上传封面',
        'price.require'          => '请输入售价',
        'scribing_price.require' => '请输入原价',
        'mhm_id.require'         => '请选择所属机构',
        'teacher_id.require'     => '请选择讲师',
        'limit_buy_count'        => '购买人数为1~16人'

    ];
}
